package com.lzs.bootsafety.business.sys.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lzs.bootsafety.common.base.mapper.Insert;
import com.lzs.bootsafety.common.base.mapper.Update;
import com.lzs.bootsafety.common.util.easyexcel.Converter.GenderConverter;
import com.lzs.bootsafety.common.util.easyexcel.Converter.StatusConverter;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * @author  zhanshi Liu
 * @date    2020/03/22
 * @website www.jhmsona.cn
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SysUser extends BaseEntity implements Serializable{
    class Select{}
    private static final long serialVersionUID = 1L;
    @ExcelIgnore
    private Long userId;
    @NotBlank(message = "用户名不能为空",groups = {Insert.class, Update.class,Select.class})
    @ExcelProperty("用户名")
    private String username;
    @NotBlank(message = "密码不能为空",groups = {Insert.class,Update.class,Select.class})
    @ExcelIgnore
    @Ignore
    private String password;
    @ExcelIgnore
    private String salt;
    @ExcelProperty("邮箱")
    private String email;
    @ExcelProperty("手机号")
    private String mobile;
    @ExcelProperty(value = "性别",converter = GenderConverter.class)
    private String gender;
    @ExcelIgnore
    private String avatar;
    @ExcelProperty("部门")
    private Long deptId;
    @ExcelProperty(value = "状态",converter = StatusConverter.class)
    private String status;
    @ExcelProperty("用户类型")
    private String userType;
    @ExcelProperty("最后登录IP")
    private String lastLoginIp;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ExcelProperty("最后登录时间")
    private Date lastLoginTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ExcelProperty("创建时间")
    private Date createTime;
    @ExcelProperty("创建人")
    private String createPeople;
    @ExcelProperty("更新人")
    private String updatePeople;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ExcelProperty("更新时间")
    private Date updateTime;
    @ExcelIgnore
    private SysDept dept;
    @ExcelIgnore
    private Long[] roleIds;
    @ExcelIgnore
    private Long[] postIds;
}